<script setup>
    import { ref, computed } from 'vue';
    const count = ref(2);

    const alwaysSmall = computed({
        get(previous) {
            console.log('previous', previous);
            if (count.value <= 3) {
                return count.value;
            }
            return previous;
        },
        set(newValue) {
            count.value = newValue * 2;
        }
    });
</script>

<template>
    <h1>获取上一个值</h1>
    Count: <input v-model="count" type="number" /> &nbsp;&nbsp;

    New result is <input type="number"  v-model="alwaysSmall" />
</template>
